using System;
using System.Web.Mvc;
using FluentValidation.Mvc;
using MvcContrib.Filters;

namespace ECommerce.Web.Controllers
{
    [ModelStateToTempData]
    public abstract class BaseController : Controller
    {
        protected void InvokeCommand(Action action)
        {
            try
            {
                action.Invoke();
            }
            catch (ValidationException ex)
            {
                ex.Result.AddToModelState(ModelState, String.Empty);
            }
        }
    }
}